package com.itheima.service.impl;

import com.itheima.mapper.MemberDao;
import com.itheima.pojo.MemberTOD;
import com.itheima.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class MemberServiceimpl implements MemberService {

    @Autowired
    private MemberDao memberDao;

    @Override
    public void register(MemberTOD memberTOD) {

//        检测当前手机号是否已经注册
        String telephone = memberDao.getTelephone(memberTOD.getTelephone());
        if(telephone == null) {

//            获取当前时间
            Date date = new Date();

            memberDao.register(memberTOD.getTelephone() , date);

        }


    }
}
